package com.twb.core.base.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.type.JdbcType;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.twb.core.util.DateUtil;

import io.swagger.annotations.ApiModelProperty;

/**
 * @author DSY
 * @ClassName BaseEntity
 * @Description 基础实体类
 * @date 2018年11月1日 下午2:18:53
 */
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String FIELD_CREATOR_ID = "creatorId";
    public static final String FIELD_CREATOR = "creator";
    public static final String FIELD_CREATE_DATE = "createDate";
    public static final String FIELD_UPDATER_ID = "updaterId";
    public static final String FIELD_UPDATER = "updater";
    public static final String FIELD_UPDATE_DATE = "updateDate";
    public static final String FIELD_CREATOR_ORGID = "creatorOrgid";

    @TableField(value = "isdel", jdbcType = JdbcType.INTEGER)
    protected Integer isdel;
    //
    // 下面是标准 WHO 字段
    // ----------------------------------------------------------------------------------------------------
    /**
     * 创建人用户名
     */
    @TableField(value = "creator_id", jdbcType = JdbcType.VARCHAR)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected String creatorId;
    /**
     * 创建人名称
     */
    @TableField(value = "creator", jdbcType = JdbcType.VARCHAR)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected String creator;
    /**
     * 创建时间
     */
    @TableField(value = "create_date", jdbcType = JdbcType.TIMESTAMP)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = DateUtil.DEFAULT_PATTERN)
    @ApiModelProperty(name = "createDate", value = "创建时间", example = "2019-06-22 00:00:00", required = false)
    protected LocalDateTime createDate;

    /**
     * 更新人用户名
     */
    @TableField(value = "updater_id", jdbcType = JdbcType.VARCHAR)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected String updaterId;
    /**
     * 更新人名称
     */
    @TableField(value = "updater", jdbcType = JdbcType.VARCHAR)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected String updater;
    /**
     * 更新时间
     */
    @TableField(value = "update_date", jdbcType = JdbcType.TIMESTAMP)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = DateUtil.DEFAULT_PATTERN)
    @ApiModelProperty(name = "updateDate", value = "更新时间", example = "2019-06-22 00:00:00", required = false)
    protected LocalDateTime updateDate;

    /**
     * 创建人机构ID
     */
    @TableField(value = "creator_orgid", jdbcType = JdbcType.VARCHAR)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected String creatorOrgid;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }


    public String toJSONString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }

    public Integer getIsdel() {
        return isdel;
    }

    public void setIsdel(Integer isdel) {
        this.isdel = isdel;
    }

    public String getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(String creatorId) {
        this.creatorId = creatorId;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public LocalDateTime getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }

    public String getUpdaterId() {
        return updaterId;
    }

    public void setUpdaterId(String updaterId) {
        this.updaterId = updaterId;
    }

    public String getUpdater() {
        return updater;
    }

    public void setUpdater(String updater) {
        this.updater = updater;
    }

    public LocalDateTime getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(LocalDateTime updateDate) {
        this.updateDate = updateDate;
    }

    public String getCreatorOrgid() {
        return creatorOrgid;
    }

    public void setCreatorOrgid(String creatorOrgid) {
        this.creatorOrgid = creatorOrgid;
    }
}
